package com.wangmei.controller;

import com.wangmei.pojo.UserSimplify;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import unitTool.Dictionary;

import javax.servlet.http.HttpSession;

@Controller
public class AdminController {

    @RequestMapping("/after")
    public String goToAdminPage(HttpSession session){
        UserSimplify user = (UserSimplify) session.getAttribute(Dictionary.SessionKey.CURRENT_USER);
        if(user == null)
            return "redirect:/shop/index.html";
        if(user.getRid() == Dictionary.RoleId.MANAGER_ROLE)
            return "redirect:/admin/index.html";
        return "redirect:/shop/index.html";
    }
}
